package com.rd.student.jike.class2.lihongming.week724_730.Day725;

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;

/**
 * @Auther:Heinrich
 * @Date:2023/7/25-07-25-14:45
 * @Description:c230725
 * @version:1.0
 */
public class TestStream {
    public static void main(String[] args) throws IOException {
        File file = new File("stream.txt");
        if (!file.exists()) {
            file.createNewFile();
        }
        String content = "Hello stream";
        OutputStream os = Files.newOutputStream(file.toPath());
        //写入字节数组型的内容
        os.write(content.getBytes(StandardCharsets.UTF_8));
        os.close();
    }
}
